/**
 * 复选框组件
 * add by lifenping
 * on 20200304
*/
import React from 'react';
import { Form, Checkbox } from 'antd';

const FormItem = Form.Item;
const CheckboxGroup = Checkbox.Group;

interface optionsType {
  lable?: any;
  value?: any;
}

interface PropsType {
  label?: any;
  name?: any;
  initialValue?: any;
  rules?: any;
  getFieldDecorator?: any;
  options?: optionsType[];
  itemLayout?: {};
  placeholder?: string;
}

const SelectItem: React.FC<PropsType> = props => {
  const { label, name, options, initialValue, itemLayout, rules, getFieldDecorator,
    ...othersProps } = props;
  return (
    <FormItem label={label} {...itemLayout} hasFeedback={!!rules} >
      {getFieldDecorator(name, {
        initialValue,
        rules,
      })(
        <CheckboxGroup options={options} {...othersProps} />
      )}
    </FormItem>
  );
}
export default SelectItem;
